<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<script type="text/javascript">
   $(function(){
	   $(".search").focus(function cls() {
			//alert("324");
			if ($(this).val() == "检索信息") 
				{
				$(this).val("");
				}
	    });
	    $(".search").blur(function res() {
	    	//alert("324");
	    	if ($(this).val() == "")
	    		$(this).val("检索信息");
	       
	    });
	   $("#searchbtn").click(function(){
		   alert($("#nbkind").val());
           $("#nbtypehi1").val($("#nbkind").val());
	   });
	    function getContent() {
	    	
            
	    };
   });
    	
</script>
<c:if test="${message }">
         <div style='height:70px;background-color: #eee;'>
           <table class='table' style='width:100%;'>
          <tr>
             <td align="center">
               <strong style='color: #990000;font-size: 14px;'> 
                <b> 管理员：${user.realName }</b>  	,  添加新闻公告成功，你可以继续<a href='<%=basePath%>backend/addnewsui'>添加</a>！</strong>
             </td>
          </tr> 
         </table>
         </div>
   </c:if>
	<div class="border_color  title_color">
	<h3 style='margin-left:20px;'>新闻管理</h3>
</div>

	<div class='row'>
		<div class="span6 input-prepend" style='margin-bottom:10px;margin-left:20px;'>
                 <span class="add-on">类型</span>
                  <select class="" id='nbkind' name='bn'>
                     <option value='news'>新闻</option>
                     <option value="bulletin">公告</option>
                  </select>
       </div>
       <div class='span5'>
		<form action="<%=basePath%>backend/search" method="post">
			<input type="text" name='title' value="检索信息" id='search'
				class="init search" style='height: 30px; margin-top: 10px;'>
			<input type="hidden" id='nbtypehi1' name='nbtypehi' />
			 <input
				class='btn' type="submit" id='searchbtn' value="找找看"
				>
		</form>
	</div>
    <br><br>
			<div class='span12' style='margin-left:0px;margin-top:10px;margin-left:15px;'>
			<div id="newses" class='span12' style='margin-left:0px;'>
			  <table style="width: 100%" class="table table-hover ">
			  
				<c:choose>
					<c:when test="${empty newses }">
						<tr>
							<td colspan="3" style="color: red" align="center">暂时没有新闻。可<a href='<%=basePath%>backend/addnewsui'>添加</a></td>
						</tr>
					</c:when>
					<c:when test="${not empty newses}">
					    <tr>
					       <td style='' class='content_td1'>标题</td>
					      
					       <td  class='content_td3'>操作</td>
					    </tr>
						<c:forEach items="${newses }" var="news" varStatus="status">
							<tr class='discuss'>
								<td class="content_td1 ">
								    <div class='newsTitle1'><a
									href="<%=basePath %>backend/newsdetail/${news.id }" title='${news.title}'>
									<span >${news.title}</span>
									</a></div>
								</td> 
								<td class="content_td3"><a href='#'><button te='${news.id }' url='deletenbs' backurl='newsmagui' style='width:80px;' class='del btn btn-danger'>删除</button></a>
								  |	<a href='<%=basePath %>backend/updatenewui/${news.id }' style='width:80px;' class="updatenews btn btn-warning"  >
                                                                                          修改
                                   </a>
                                   <!-- Modal -->
                                   <c:if test="${!news.isimportant}">
                                | 
                                  <button  te='${news.id }' text='${news.index}' style='width:100px;' class="setimportantnews btn btn-primary" >
                                <i class="icon-arrow-up" ></i>置顶</button>
                                </c:if>
                                <c:if test="${news.isimportant }">
                                | 
                                      <button  te='${news.id }' text='${news.index}' style='width:100px;' class="cancelimportantnews btn btn-primary" >
                                 <i class="icon-arrow-down" ></i>取消置顶</button>
                                </c:if>
                           <c:if test="${not empty news.url }">
                           | 
                                <c:if test="${news.index==0 }">
                                  <button  te='${news.id }' text='${news.index}' style='width:160px;' class="totopn btn btn-primary" >
                                <i class="icon-arrow-up" ></i>首页图片新闻</button>
                                </c:if>
                                <c:if test="${news.index==1 }">
                                      <button  te='${news.id }' text='${news.index}' style='width:160px;' class="canceltopn btn btn-primary" >
                                 <i class="icon-arrow-down" ></i>取消首页图片新闻</button>
                                </c:if>
                              </c:if>
                             
                           
                                
                             
								</td>
								</tr>
						</c:forEach>
						<input value="${newsesCount }" id="newsesCount" type="hidden"/>
					</c:when>
				</c:choose>
			
			  </table>
			  <div id="pageDir"  style='margin-top:5px;margin-left:200px;'></div>
			  </div>
			<div id="bulletins" class='span12' style='margin-left:0px;'>
			<table  style="width: 100%"  class="table table-hover ">
			
				<c:choose>
					<c:when test="${bulletins==null }">
						<tr class='r1'>
							<td colspan="3" align="center">暂时没有公告。可<a href='<%=basePath%>backend/addnewsui'>添加</a></td>
						</tr>
					</c:when>
					<c:when test="${bulletins!=null }">
					    <tr>
					       <td style='' class='content_td1'>标题</td>
					      
					       <td  class='content_td3'>操作</td>
					    </tr>
						<c:forEach items="${bulletins }" var="news" varStatus="status">
							<tr class='r1 discuss1'>
								<td class="content_td1">
								   <div class='newsTitle1'> <a
									href="<%=basePath %>backend/newsdetail/${news.id }" title='${news.title}'>
									<span class=''>${news.title}</span>
									</a></div>
								</td>
								<td class="content_td2"></td>
								
								<td class="content_td3"><a href='#'><input te='${news.id }' url='deletenbs' backurl='newsmagui' style='width:80px;' class='del btn btn-danger' value='删除'/></a>
								  |	<a href='<%=basePath %>backend/updatenewui/${news.id }' style='width:80px;' class='btn btn-info' >
                                                                                          修改
                                   </a>
                                   | 
                                   
                                   <c:if test="${news.index==1 }">
                                      <button  te='${news.id }' text='${news.index}' style='width:100px;' class="canceltopb btn btn-primary" >
                            <i class="icon-arrow-down" ></i>取消置顶</button>
                                   </c:if>
                                   <c:if test="${news.index==0 }">
                                      <button  te='${news.id }' text='${news.index}' style='width:100px;' class="totopb btn btn-primary" >
                            <i class="icon-arrow-up" ></i>置顶</button>
                                   </c:if>
                                   
                                   <!-- Modal -->
								</td>
								</tr>
						</c:forEach>
						<input value="${bulletinsCount }" id="bulletinsCount" type="hidden"/> 				
					</c:when>
				</c:choose>
			</table>
			<div id="pageDir1" style='margin-top:5px;margin-left:200px;'></div> 
			</div>
			</div>
	</div>
